using System;
using System.Collections.Generic;
using System.Text;
using NBusiness.Query;

namespace NBusiness.MySql.Query
{
    public class MySqlPrimitive : IEvaluatable
    {
        public MySqlPrimitive() { }
        public MySqlPrimitive(object value)
        {
            _value = value;
        }

        private object _value;
        public object Value
        {
            get { return _value; }
            set { _value = value; }
        }

        #region IRelationalElement Members

        public string ToSql()
        {
            if (_value == null)
                return "NULL";
            else if (_value is string || _value is DateTime || _value is Guid)
                return "'" + _value.ToString() + "'";
            else return _value.ToString();
        }

        #endregion
    }
}
